home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / COINS.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  1KB  |  33 lines

  1. ' COINS.BAS
  2. ' This program uses the WRITE# statement to send coin-collection
  3. '   information to a sequential file in fields.
  4.  
  5. OPEN "COINS.TXT" FOR OUTPUT AS #1  ' open file in current drive/dir
  6.  
  7. CLS
  8.  
  9. PRINT "This program stores coin-collection information on disk in a"
  10. PRINT "file named COINS.TXT.  Enter coin data and type END to quit."
  11. PRINT
  12.  
  13. DO WHILE (country$ <> "END")       ' until the user types END...
  14.  
  15. ' get coin-collection info from user and write it to the open file
  16.  
  17.     INPUT "What country is the coin from?  ", country$
  18.     IF (country$ <> "END") THEN    ' if country$ is END don't write
  19.         INPUT "What is the value of the coin?  ", value$
  20.         INPUT "What is the name of the coin?   ", coinName$
  21.         INPUT "What year was the coin minted?  ", year%
  22.  
  23.         WRITE #1, country$, value$, coinName$, year%  ' send fields
  24.     END IF
  25.     PRINT                          ' print blank lines between coins
  26.  
  27. LOOP
  28.  
  29. CLOSE #1                           ' close the file
  30.  
  31. PRINT "Information has been successfully written to COINS.TXT"
  32.  
  33.